<?php 
include("../inc/global.inc");
if($_POST[act]){
    if($_SESSION['chkCode']==$_POST['c_code']){
        $sql="select * from job_per  where p_user='$_POST[member_id]'";
		$rs=@mysql_query($sql);
        $row=@mysql_fetch_array($rs);
           if($row['id']){
		        if($row[p_psw]=$_POST[security_code]){
				  $psw=substr(md5($_POST[newpassword]),7,19);
				  @mysql_query("update job_per set p_psw='$psw' where id='".$row['id']."'");
				  echo "<script>alert('密码重置成功');location='/login/login.php';</script>";
				
				}else{
				
				echo "<script>alert('安全码错误');location='javascript:history.go(-1)';</script>";
				}
		   
		   
		   }else{
               echo "<script>alert('会员账号错误');location='javascript:history.go(-1)';</script>";
		   }
		   
		   
    }else{
      echo "<script>alert('验证码错误!');location='javascript:history.go(-1)';</script>";
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>重置密码-三帝招聘网</title>
<link href="../css/body.css" rel="stylesheet" type="text/css"/>
<link href="../css/link.css" rel="stylesheet" type="text/css"/>
<link href="css/head.css" rel="stylesheet" type="text/css"/>
<link href="../css/foot.css" rel="stylesheet" type="text/css"/>
<link href="css/login.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include("../inc/top.php");?>
<div class="main topside6 downside6">

<div class="login_box">
<div class="title">
  <table border="0" cellpadding="0" cellspacing="0" class="table">
    <tr>
      <td width="43" rowspan="2"><img src="images/icon3.gif" width="35" height="36" /></td>
      <td width="186" height="27"><img src="images/icon3txt.gif" width="88" height="20" /></td>
    </tr>
    <tr>
      <td height="20"> &nbsp;&nbsp;<span class="fontgray">使用注册邮找回密码</span> </td>
    </tr>
  </table>
</div>
<div class="login">
<form name="form" action="" method="post" onSubmit="return checkform()">
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="26" colspan="2">&nbsp;</td>
      </tr>
      <tr>
        <td width="37%" height="44" align="right"><span class="size14 b">会员账号：</span></td>
        <td width="63%"><label>
          <input name="member_id" type="text" class="login_user" />
        </label></td>
      </tr>
      <tr>
        <td width="37%" height="44" align="right"><span class="size14 b">安全码：</span></td>
        <td width="63%"><label>
          <input name="security_code" type="password" class="login_user" />
        </label></td>
      </tr>
      <tr>
        <td width="37%" height="44" align="right"><span class="size14 b">新密码：</span></td>
        <td width="63%"><label>
          <input name="newpassword" type="password" class="login_user" />
        </label></td>
      </tr>
      <tr>
        <td height="43" align="right"><span class="size14 b">确认新密码：</span></td>
        <td height="43"><label>
          <input name="newpassword2" type="password" class="login_pwd" />
        </label></td>
      </tr>
      <tr>
        <td height="43" align="right"><span class="size14 b">验证码：</span></td>
        <td height="43"><input name="c_code" type="text" class="login_code" />&nbsp;&nbsp;&nbsp;<img src="/inc/chk_num.php" name="img" width="90" height="30" align="absmiddle" id="img">&nbsp;<a href="#" id="test">刷新验证码</a></td>
      </tr>
      <tr>
        <td height="62"><input type="hidden" name="act" value="job.sandib2b.cn" /></td>
        <td height="62"><input name="Submit" type="submit" class="but" value=" 密码重设 " /></td>
      </tr>
      <tr>
        <td height="31" colspan="2" align="center">&nbsp;</td>
      </tr>
    </table>
  </form>
  </div>
</div>
</div>
<?php include("../inc/foot.php"); ?>
</body>
</html>
<script language="javascript">
function $(id){
return document.getElementById(id);
}
function checkform(){
 if($("member_id").value==""){
    alert("请输入您的账号");
    $("member_id").focus();
    return false;
 }
 if($("security_code").value==""){
   alert("请输入您的安全码");
    $("security_code").focus();
    return false;
}

 if($("newpassword").value==""){
    alert("新密码");
    $("newpassword").focus();
    return false;
}
if($("newpassword").value!=$("newpassword2").value){
alert("您两次输入的密码不一致");
$("newpassword2").focus();
return false;
}


}

function test(img){
    var src=img.getAttribute("src");
    src=src+"?new="+Math.random(0,10);
    img.setAttribute("src",src);
}
function prepare(){
    var nav=document.getElementById("test");
    var name=nav.getAttribute("name");
    var str="can not see";
    if(name==str){
        nav.onclick=function(){
            var img=document.getElementById("img");
            test(img);
            return false;
        }
    }
}
window.onload=prepare;
</script>
